package ipad.asia.controller;

import ipad.asia.service.shop.ShopFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpSession;

@Controller
public class ChatController {
    @Autowired
    private ShopFeign shopFeign;
    @RequestMapping("/chat")
    public String chat(@RequestParam(value = "shopId",required = false)int shopId,
                       HttpSession session, Model model){
       String shopName = shopFeign.findById(shopId).getName();
       String name= (String) session.getAttribute("user");
        System.out.println("name"+name);
       model.addAttribute("shopName",shopName);
       model.addAttribute("myName",name);
        return "chat";
    }
}
